package barbershop.com.dao.orders;

import barbershop.com.entity.orders.OrderPayment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface OrderPaymentDao extends JpaRepository<OrderPayment, Integer> {
    @Modifying
    @Query(value = "update order_payment set transaction_amount=?1 where pay_id=?2",
            nativeQuery = true)
    void updateTransAmount(Double transAmount, Integer payId);

    @Query(value = "SELECT * FROM order_payment where order_id=?1",
            nativeQuery = true)
    OrderPayment findByOrderId(Integer id);
}
